package dmt16.TelemetrySuit.Communication.PacketTypes
{
	import flash.utils.ByteArray;
	import flash.utils.Endian;
	
	public class InitialisationRequest implements IPacket
	{
		public function InitialisationRequest(content:ByteArray,checksum:int)
		{
			_checksum=checksum;
		}
		
		public function get type():int
		{
			return PacketType.DVC_INIT;
		}
		
		public function get dataLength():int
		{
			return 0;
		}
		
		private var _checksum:uint;
		public function get checksum():uint
		{
			return _checksum;
		}
		
		public function set checksum(c:uint):void
		{
			_checksum=c;
		}
		
		public function validateChecksum():Boolean
		{
			return true;
		}
		
		public function updateChecksum():void
		{
			_checksum=0;
		}
		
		private function _calculateChecksum():uint{
			return 0;
		}
		
		public function outputBinary():ByteArray
		{
			var output:ByteArray=new ByteArray();
			output.endian=Endian.LITTLE_ENDIAN;
			output.writeByte(0x01); // start
			output.writeByte(type);	//type
			output.writeShort(0);	//length
			output.writeShort(0);	//checksum
			output.writeByte(0x04);	//end
			return output;
		}
	}
}